package com.zqh.myfmmall.rowbeans.vo;

import com.zqh.myfmmall.rowbeans.doc.ProductDocument;
import com.zqh.myfmmall.rowbeans.entity.Product;
import com.zqh.myfmmall.rowbeans.entity.ProductImg;
import com.zqh.myfmmall.rowbeans.entity.ProductParams;
import com.zqh.myfmmall.rowbeans.entity.ProductSku;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Description : 这里还是按pdf中那样设计比较好，但是懒得改了
 * @Author :kono淇杭哒、
 * @Create 2022-01-25 1:37
 */
@Data
@NoArgsConstructor
public class ProductVo extends Product{
    //以下属性在不同接口的请求下按需注入，可能为空，所以没有通过构造器来注入，通过set方法来注入
    private List<ProductImg> productImgs;
    private String mainImgUrl;
    private List<ProductSku> productSkus;
    private ProductParams productParams;
    private Map<String,Integer> commentsCount;
    private BigDecimal lowestPrice;

    public ProductVo(Product product){
        this.setProductId(product.getProductId());
        this.setProductName(product.getProductName());
        this.setProductStatus(product.getProductStatus());
        this.setContent(product.getContent());
        this.setCategoryId(product.getCategoryId());
        this.setSoldNum(product.getSoldNum());
    }

   /* public ProductVo(ProductDocument productDocument){
        this.setProductId(productDocument.getProductId());
        this.setProductName(productDocument.getProductName());
        this.setMainImgUrl(productDocument.getProductMainImgUrl());
        this.setSoldNum(productDocument.getSoldNum());
        this.setContent(productDocument.getContent());
        this.setLowestPrice(productDocument.getLowestPrice());
    }*/
}
